package com.xebest.web.service;

import com.xebest.web.form.*;
import com.xebest.web.model.XeVenAfterSaleDetailEntity;
import com.xebest.web.model.XeVenAfterSaleEntity;
import com.xebest.web.model.XeVenOrderInfoDetailEntity;
import com.xebest.web.model.XeVenOrderInfoEntity;
import com.xebest.web.view.*;

import java.util.List;
import java.util.Map;

/**
 * @desc:
 * @author: chenjing
 * @createTime: 2017/6/20 0020 下午 8:36
 * @history:
 * @version:v1.0
 */
public interface XeVenAfterSaleService {

    /**
     * 根据查询条件查询售后单列表
     * @Author:chenjing
     * @Description:
     * @Date:下午 8:40 2017/6/20 0020
     * @params: * @param null
     * @return:
     */
    List<XeVenAfterSaleView> queryAfterSaleList(XeVenAfterSaleQueryForm entity) throws Exception;

    /**
     * @Author:chenjing
     * @Description: 根据售后单编号删除售后单
     * @Date:下午 8:31 2017/6/19 0019
     * @params: * @param id
     * @return: int
     */
    int deleteByAfterSalesCode(XeVenAfterSaleEntity entity) throws  Exception;

    /**
     * @Author:chenjing
     * @Description:作废售后单
     * @Date:16:53 2017/8/2
     * @params: * @param null
     * @return:
     */
    int cancelAfterSale(XeVenAfterSaleEntity entity) throws  Exception;
    /**
     * @Author:chenjing
     * @Description: 插入售后单信息
     * @Date:下午 8:32 2017/6/19 0019
     * @param record 售后单封装后实体
     * @param  list  售后类型为退货退款，存放商品sku和退货数量
     * @param orderInfoDetailList  对应的订单明细信息
     * @return:
     */
    int insertAfterSale(XeVenAfterSaleEntity record, List<XeVenAfterSaleDetailEntity> list, List<XeVenOrderInfoDetailEntity> orderInfoDetailList) throws Exception;

    /**
     * @Author:chenjing
     * @Description: 编辑售后单信息
     * @Date:下午 8:32 2017/6/19 0019
     * @param record 售后单封装后实体
     * @param  list  售后类型为退货退款，存放商品sku和退货数量
     * @param orderInfoDetailList  对应的订单明细信息
     * @return:
     */
    int updateAfterSale(XeVenAfterSaleEntity record, List<XeVenAfterSaleDetailEntity> list, List<XeVenOrderInfoDetailEntity> orderInfoDetailList) throws Exception;

    /**
    * @Author:chenjing
    * @Description:根据orderId查询订单详细信息
    * @Date:下午 7:59 2017/6/22 0022
    * @params: * @param null
    * @return:
    */
    XeVenOrderInfoEntity queryOrderInfoByOrderId(String orderId,String userCode);

    /**
     * @Author:chenjing
     * @Description: 根据售后单号查询售后单信息
     * @Date:下午 1:44 2017/6/23 0023
     * @params: * @param null
     * @return:
     */
    XeVenAfterSaleEntity selectByPrimaryKey(String afterSalesCode,String userCode);

    /**
     * @Author:chenjing
     * @Description:更新售后单信息
     * @Date:下午 2:05 2017/6/23 0023
     * @params: * @param null
     * @return:
     */
    int updateByPrimaryKey(XeVenAfterSaleEntity record) throws Exception;



    /**
     * @Author:chenjing
     * @Description: 审核退款单
     * @Date:上午 10:52 2017/6/27 0027
     * @params: * @param null
     * @return:
     */
    int batchRefund(String refundCode,String refundStatus) throws  Exception;

    /**
     * @Author:chenjing
     * @Description: 根据售后单号 订单号查询订单详细信息
     * @Date:下午 4:10 2017/7/1 0001
     * @params: * @param null
     * @return:
     */
    List<XeVenAfterSaleDetailView> getOrderDetial(XeVenAfterSaleDetailForm from) throws  Exception;

    /**
     * @Author:chenjing
     * @Description: 批量审核售后单
     * @Date:下午 4:53 2017/7/3 0003
     * @params: * @param null
     * @return:
     */
    int batchAfterSalesList(XeVenAfterSaleCheckForm form) throws  Exception;

    /**
     * @Author:chenjing
     * @Description: 批量删除售后单
     * @Date:上午 10:45 2017/7/7 0007
     * @params: * @param null
     * @return:
     */
    int delAfterSaleList(XeVenAfterSaleDelForm form) throws  Exception;

    /**
     * @Author:chenjing
     * @Description:批量作废售后单
     * @Date:17:07 2017/8/2
     * @params: * @param null
     * @return:
     */
    int cancelAfterSaleList(XeVenAfterSaleDelForm form) throws  Exception;

    /**
     * @Author:chenjing
     * @Description:根据订单号查询订单明细中每个商品的已退款金额和已退货数量
     * @Date:16:19 2017/8/1
     * @params: * @param null
     * @return:
     */
    List<XeVenRejectRefundDetailView> getRefundAndReject(Map paramMap);

    /**
     * @Author:chenjing
     * @Description:根据售后单号查询售后单信息 带订单信息（编辑售后单时使用）
     * @Date:11:50 2017/8/3
     * @params: * @param null
     * @return:
     */
    XeVenAfterSaleInfoView queryAfterSaleInfo(XeVenAfterSaleDetailForm form) throws  Exception;

    /**
     * @Author:chenjing
     * @Description:查询订单列表
     * @Date:17:57 2017/8/3
     * @params: * @param null
     * @return:
     */
    List<XeVenAfterSaleOrderView> queryAfterSaleOrderList(XeVenAfterSaleOrderQueryForm from);

    /**
     * @Author:chenjing
     * @Description:根据订单号查询订单明细信息
     * @Date:19:21 2017/8/3
     * @params: * @param null
     * @return:
     */
    List<XeVenAfterSaleDetailView> queryOrderInfoDetail(XeVenAfterSaleDetailForm form);

    /**
     * 根据订单号统计售后单
     * @param orderId
     * @return
     */
	Long selectAfterSaleByOrderId(String orderId);
}
